<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Array Test</title>
<script type="text/javascript" src="../liwe.js"></script>
<script type="text/javascript" src="../utils.js"></script>
<script type="text/javascript" src="../object_enh.js"></script>
<script type="text/javascript" src="../array_enh.js"></script>
<script type="text/javascript" src="../string_enh.js"></script>
<script type="text/javascript">
function test_format ()
{
	var s = String.format ( "The number is: '%+10.4d' of '%s' %2.2d", -123, "ciao", "09" );

	// console.debug ( s );
	alert ( s );

	s = String.formatDict ( "The number is (100% sure): '%(num)+10.4d' or '%(name)-20.5s' Missing: %(miss)s", { 'num' : 10, 'name' : 'ciao' } );
	alert ( s );

} 

function test_buffers ()
{
	var b1 = new String.buffer ();
	var b2 = new String.buffer ();

	b1.add ( "hello" );
	b1.add ( "world" );

	b2.add ( "this" );
	b2.add ( "is" );
	b2.add ( "the" );
	b2.add ( "end" );

	alert ( b1.get ( " " ) );
	alert ( b2.get ( "-" ) );

	b2.add ( b1.get () );
	alert ( b2.get ( " " ) );
}

function test_htmlentities ()
{
	var txt = $v ( "txtarea" );
	var s;

	s = txt.htmlEntities ();

	alert ( s + "\n----------\n" + s.entities2char () );
};

</script>
</head> 
<body>
<a href="javascript:test_format()">Test Format</a>
<br />
<a href="javascript:test_buffers()">Test Buffers</a>
<br />
<a href="javascript:test_htmlentities()">Test htmlEntities</a>
<textarea id="txtarea"></textarea>


</body>
</html>
